%{
#include <stdio.h>
#include <string.h>
#include "coolinary.h"
#include "y.tab.h"
%}
%%
water|fruit|grain|vegetable|liquid|meat|dairy		yylval.text=strdup(yytext); return FTYPE;
boil|chop|bake|grill|fry					yylval.text=strdup(yytext); return MNAME;
"addfunc"			return ADDFUNC;
"group"			return GROUP;
"print"			return PRINT;
"int"				return INT;
"string"			return STRING;
"name"				return NAME;
"quantity"			return QUANTITY;
"nutrition"			return NUTRITION;
"time"				return TIME;
"=="				return EQ;
"!="				return NE;
"<"				return LT;
"<="				return LE;
">"				return GT;
">="				return GE;
"+"				return PLUS;
"-"				return MINUS;
"*"				return TIMES;
"/"				return OVER;
"++"				return INC;
"--"				return DEC;
"="				return ASSIGN;
"if"				return IF;
"else"				return ELSE;
"while"			return WHILE;
"repeat"			return REPEAT;
"."				return DOT;
"{" 				return OBRACE;
"}" 				return EBRACE;
"("				return OPAREN;
")"				return EPAREN;
";"				return SEMI;
","				return COMMA;
[A-Za-z][A-Za-z0-9]*		yylval.text=strdup(yytext); return ID;
[0-9]+				yylval.num=atoi(yytext); return ILIT;
\"[^\"]*\"			yylval.text=strncpy(calloc(strlen(yytext)-2,sizeof(char)),yytext+1,strlen(yytext)-2); return SLIT;
\/\*.*\*\/			/* ignore comments */;
\n                      	/* ignore end of line */;
[ \t]+                  	/* ignore whitespace */;
%%